import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        boolean[] arr = new boolean[10];
        System.out.println(Arrays.toString(arr));
    }

    public double myPow(double x, int n) {
        return n < 0 ? 1.0 / pow(x, -(long)n) : pow(x, n);
    }

    public double pow(double x, long n) {
        if(n == 0) {
            return 1.0;
        }
        double tmp = pow(x, n / 2);
        return n % 2 == 1 ? tmp * tmp * x : tmp * tmp;
    }

    public ListNode swapPairs(ListNode head) {
        if(head == null || head.next == null) {
            return head;
        }
        ListNode tmp = swapPairs(head.next.next);
        ListNode ret = head.next;
        ret.next = head;
        head.next = tmp;
        return ret;
    }

    static class ListNode {
        int val;
        ListNode next;

        public ListNode(int val) {
            this.val = val;
        }
    }

    public ListNode reverseList(ListNode head) {
        if(head == null || head.next == null) {
            return head;
        }

        ListNode newHead = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return newHead;
    }
}
